package com.linyaonan.zuochengyun._01._01;

/**
 * @author: Lin
 * @date: 2022/7/24
 */
public class BinaryPrint {

    public static void main(String[] args) {
        print(1234);
    }

    public static void print(int p) {

        System.out.println(Integer.toBinaryString(p));

        StringBuilder sb = new StringBuilder();
        for (int i = 31; i >= 0; i--) {
            int z = p >> i & 1;
            sb.append((z == 0) ? "0" : "1");
        }

        System.out.println(sb.toString());

    }

}
